/**
 * This class contains all the data that is extracted
 * from the XML file and is inserted into the database
 * @author Marco Vellinga
 * @author Sander Wagenaar
 *
 */
public class Data {
	
	// Variables
	String stn;
	String date;
	String time;
	String temp;
	String dewp;
	String stp;
	String slp;
	String visib;
	String wdsp;
	String prcp;
	String sndp;
	String frshtt;
	String cldc;
	String wnddir;
	
	fillData fillData;
	
	/**
	 * Constructor
	 */
	public Data(){
		fillData = new fillData();
	}
	
	// Setters for the variables
	
	public void setStn(String stn){
		this.stn = stn;
	}
	
	
	public void setDate(String date){
		this.date = date;
	}
	
	public void setTime(String time){
		this.time = time;
	}
	
	public void setTemp(String temp){
		
		if(fillData.checkEmpty(temp)){
			this.temp = Double.toString(Math.round(fillData.extrapolatie(getStn(), "temp")));
		} else {
			if(fillData.returnValidTemp(getStn(), temp) == 0.0){
				this.temp = temp;
			} else {
				this.temp = Double.toString(Math.round(fillData.returnValidTemp(getStn(), temp)));
			}
		}
		
		
	}
	
	public void setDewp(String dewp){
		
		if(fillData.checkEmpty(dewp.trim())){
			this.dewp = Double.toString(Math.round(fillData.extrapolatie(getStn(), "dewp")));
		} else {
			this.dewp = dewp;
		}
	}
	
	public void setStp(String stp){
		
		if(fillData.checkEmpty(stp.trim())){
			this.stp = Double.toString(Math.round(fillData.extrapolatie(getStn(), "stp")));
		} else {
			this.stp = stp;
		}
	}
	
	public void setSlp(String slp){
		
		if(fillData.checkEmpty(slp.trim())){
			this.slp = Double.toString(Math.round(fillData.extrapolatie(getStn(), "slp")));
		} else {
			this.slp = slp;
		}
	}
	
	public void setVisib(String visib){
		
		if(fillData.checkEmpty(visib.trim())){
			this.visib = Double.toString(Math.round(fillData.extrapolatie(getStn(), "visib")));
		} else {
			this.visib = visib;
		}
	}
	
	public void setWdsp(String wdsp){
		
		if(fillData.checkEmpty(wdsp.trim())){
			this.wdsp = Double.toString(Math.round(fillData.extrapolatie(getStn(), "wdsp")));
		} else {
			this.wdsp = wdsp;
		}
	}
	
	public void setPrcp(String prcp){
		
		if(fillData.checkEmpty(prcp.trim())){
			this.prcp = Double.toString(Math.round(fillData.extrapolatie(getStn(), "prcp")));
		} else {
			this.prcp = prcp;
		}
	}
	
	public void setSndp(String sndp){
		
		if(fillData.checkEmpty(sndp.trim())){
			this.sndp = Double.toString(Math.round(fillData.extrapolatie(getStn(), "sndp")));
		} else {
			this.sndp = sndp;
		}
	}
	
	public void setFrshtt(String frshtt){
		this.frshtt = frshtt;
	}
	
	public void setCldc(String cldc){
		
		if(fillData.checkEmpty(cldc.trim())){
			this.cldc = Double.toString(Math.round(fillData.extrapolatie(getStn(), "cldc")));
		} else {
			this.cldc = cldc;
		}
	}
	
	public void setWnddir(String wnddir){
		
		if(fillData.checkEmpty(wnddir.trim())){
			this.wnddir = Double.toString(Math.round(fillData.extrapolatie(getStn(), "wnddir")));
		} else {
			this.wnddir = wnddir;
		}
	}
	
	// Getters for the variables
	
	public String getStn(){
		return stn;
	}
	
	public String getDate(){
		return date;
	}
	
	public String getTime(){
		return time;
	}

	public String getTemp(){
		return temp;
	}
	
	public String getDewp(){
		return dewp;
	}
	
	public String getStp(){
		return stp;
	}
	
	public String getSlp(){
		return slp;
	}
	
	public String getVisib(){
		return visib;
	}
	
	public String getWdsp(){
		return wdsp;
	}
	
	public String getPrcp(){
		return prcp;
	}
	
	public String getSndp(){
		return sndp;
	}
	
	public String getFrshtt(){
		return frshtt;
	}
	
	public String getCldc(){
		return cldc;
	}
	
	public String getWnddir(){
		return wnddir;
	}
}
